<!-- @format -->

<template>
  <div>
    <ul>
      <li
        v-for="item in arr"
        :key="item.id">
        {{ item.name }}
      </li>
    </ul>
    <button @click="insert">插入新来的</button>
  </div>
</template>

<script>
  export default {
    data() {
      return {
        arr: [
          {
            id: 50,
            name: '老大'
          },
          {
            id: 31,
            name: '老二'
          },
          {
            id: 10,
            name: '老三'
          }
        ]
      }
    },
    methods: {
      insert() {
        this.arr.splice(1, 0, {
          id: 19,
          name: '新来的'
        })
      }
    }
  }
</script>

<style></style>
